<script type="text/javascript">
	

    function ajaxFilterDistrict(city_id)
    {
        $.ajax({
        url: '<?php echo $this->Html->url(array("controller" => "districts", "action" => "ajaxDistrictOption", "admin" => false));?>/'+city_id,        
        success: function( data ) {
            if (console && console.log){
              $("#NhucaubanDistrictId").html(data);
	      //alert($("#ProductDistrictId").val());
	      //ajaxFilterProject($("#ProductDistrictId").val());
            }
          }
        });
    }
    
    function ajaxFilterCareer(city_id)
    {
        $.ajax({
        url: '<?php echo $this->Html->url(array("controller" => "careers", "action" => "ajaxCareerOption", "admin" => false));?>/'+city_id,        
        success: function( data ) {
            if (console && console.log){
              $("#NhucaubanCareerId").html(data);
	      //alert($("#ProductDistrictId").val());
	      //ajaxFilterProject($("#ProductDistrictId").val());
            }
          }
        });
    }

</script>

<div class="Nhucaubans form">
<?php echo $this->Form->create('Nhucauban', array('type' => 'file'));?>
	<fieldset>
		<legend><?php __('Admin Edit Nhucauban'); ?></legend>
	<?php
		echo $this->Form->input('id');
		echo $this->Form->input('user_id');
		echo $this->Form->input('city_id', array("onchange"=>"ajaxFilterDistrict(this.value);ajaxFilterCareer(this.value);", 'label'=>'Tỉnh/Thành'));
		echo $this->Form->input('district_id');
		echo $this->Form->input('career_id');
		echo $this->Form->input('name');
		echo $this->Form->input('price');
		echo $this->Form->input('unit');
		echo $this->Form->input('hit');
		echo $this->Form->input('create_date');
		echo $this->Form->input('from');
		echo $this->Form->input('sale_name');
		echo $this->Form->input('sale_phone');
		echo $this->Form->input('sale_email');
		echo $this->Form->input('discription');
		echo $this->Form->input('quantity');
		echo $this->Form->input('transfer_cost');
	?>
					
					<?php echo $this->Html->image("/uploads/nhucauban/filename/thumb/default/".$this->data["Nhucauban"]["filename"]); ?>
					
					<div class="input file">
						<label for="NhucaubanFilename">Tập tin ảnh</label>
						<input type="file" id="NhucaubanFilename" name="data[Nhucauban][filename]">
					</div>
					<input type="hidden" id="NhucaubanDir" name="data[Nhucauban][dir]" />
					<input type="hidden" id="NhucaubanMimetype" name="data[Nhucauban][mimetype]" />
					<input type="hidden" id="NhucaubanFilesize" name="data[Nhucauban][filesize]" />	
	
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Nhucauban.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Nhucauban.id'))); ?></li>
		<li><?php echo $this->Html->link(__('List Nhucaubans', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Cities', true), array('controller' => 'cities', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New City', true), array('controller' => 'cities', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Districts', true), array('controller' => 'districts', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New District', true), array('controller' => 'districts', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Careers', true), array('controller' => 'careers', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Career', true), array('controller' => 'careers', 'action' => 'add')); ?> </li>
	</ul>
</div>